package com.s3.s3demo.aws;

import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;

/**
 * AWS存储桶服务认证客户端
 */
public class AwsAuth {

    private static final String accessKeyId = "AKIARRFIVNUS72QPTRWX";
    private static final String secretAccessKey = "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";

    public static S3Client generateS3Client() {
        return S3Client.builder()
                .region(Region.CN_NORTH_1)
                .credentialsProvider(
                        StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKeyId, secretAccessKey))
                )
                .build();
    }

}
